load p2b;
n = [ 5 30 55 80 105 130 155 180 205 230 255 280 305 330 355 380 405 430 455 480 505 ];
client_in_system_average = [ 0.11 1.93 11.08 8.32 7.37 4.51 17.28 10.41 6.85 25.35 24.58 11.65 26.17 19.53 9.7 8.28 36.37 5.21 7.95 4.78 26.08 ];
client_in_system_average_2a = [  0.17 0.75 1.01 0.97 0.72 0.86 1.09 2.18 1.36 0.85 0.96 1.1 1.04 0.87 0.9 1.05 0.71 1.2 0.8 1.08 0.9 ];
client_in_system_average_2b = p2b(:,6);

queue_amount_average = [ 0 1.07 10.22 7.35 6.48 3.68 16.31 9.48 5.91 24.36 23.62 10.71 25.2 18.54 8.83 7.3 35.39 4.32 7.04 3.87 25.17 ];
queue_amount_average_2a = [ 0 0.4 0.48 0.47 0.28 0.43 0.57 1.63 0.76 0.39 0.46 0.56 0.54 0.42 0.43 0.56 0.29 0.68 0.34 0.56 0.4 ];
queue_amount_average_2b = p2b(:,7);

server_utility = [ 0.11 0.86 0.86 0.97 0.89 0.83 0.97 0.93 0.94 0.99 0.97 0.94 0.98 0.99 0.87 0.99 0.98 0.89 0.9 0.91 0.91 ];
server_utility_2a = [ 0.17 0.36 0.53 0.5 0.44 0.44 0.52 0.55 0.6 0.46 0.5 0.54 0.5 0.45 0.47 0.49 0.42 0.52 0.45 0.51 0.5 ];
server_utility_2b = p2b(:,8);

time_in_system = [ 0.33 2.02 8.71 8.09 6.84 4.9 16.17 9.53 6.46 23.42 21.92 12.05 26.33 19.76 10.28 8.64 37.59 5.21 8.46 5.22 27.26 ];
time_in_system_2a = [  0.27 0.76 0.83 0.97 0.82 0.94 1.05 1.98 1.3 0.91 0.92 1.06 1 0.93 0.91 1.07 0.79 1.12 0.81 1.03 0.91 ];
time_in_system_2b = p2b(:,1);

max_amount_queue = [ 0 5 23 13 19 12 47 25 21 46 53 25 45 30 26 21 67 22 26 20 58 ];
max_amount_queue_2a = [ 0 4 4 5 5 5 6 15 6 5 7 7 6 6 7 8 6 9 7 11 5 ];
max_amount_queue_2b = p2b(:,2);

max_delay_queue = [ 0 4.05 21.4 16.9 14.53 11.49 34.17 24.16 19.19 48.55 56.91 28.56 39.67 34.32 27.44 20.59 72.72 15.28 21.5 17.55 59.53 ];
max_delay_queue_2a = [ 0 1.98 3.01 3.66 2.18 3.1 4.13 8.99 4.09 3.81 3.11 4.15 3.22 2.97 4.6 5.43 4.95 5.16 3.29 3.74 3.67 ];
max_delay_queue_2b = p2b(:,3);

max_delay_system = [ 1.05 4.96 21.91 17.03 17.38 11.88 34.93 24.65 20.37 49.38 57.37 29.51 40.69 34.98 27.91 21.36 72.96 17.29 22.61 18.7 61.16 ];
max_delay_system_2a = [ 0.52 2.28 3.25 4.41 2.81 3.78 4.6 9.42 4.67 4.42 4.35 4.42 4.04 3.48 4.97 5.76 5.79 5.85 3.94 4.36 4.6 ];
max_delay_system_2b = p2b(:,4);

more_than_one_minute = [ 0 0.5 0.71 0.91 0.88 0.65 0.94 0.83 0.86 0.97 0.96 0.91 0.96 0.99 0.76 0.95 0.97 0.73 0.82 0.77 0.84];
more_than_one_minute_2a = [ 0 0.2 0.11 0.13 0.13 0.2 0.21 0.34 0.32 0.16 0.18 0.19 0.22 0.19 0.17 0.22 0.1 0.24 0.15 0.22 0.16 ];
more_than_one_minute_2b = p2b(:,5);

% start plotting
clf;
plot(n, client_in_system_average, "+;media 1 min;", n, client_in_system_average_2a, "o3;media 30 seg;", n, client_in_system_average_2b, "*4;2 serv/media 1 min;");
title('Promedio de clientes en el sistema vs arribo de clientes');
xlabel('Clientes arribados');
ylabel('Clientes en el sistema');
print('L_rayita.eps', '-deps');

clf;
plot(n, queue_amount_average, "+;media 1 min;", n, queue_amount_average_2a, "o3;media 30 seg;", n, queue_amount_average_2b,  "*4;2 serv/media 1 min;");
title('Promedio clientes en la cola tras vs arribo de clientes');
xlabel('Clientes arribados');
ylabel('Clientes en la cola');
print('Q_rayita.eps', '-deps');

clf;
plot(n, server_utility, "+;media 1 min;", n, server_utility_2a, "o3;media 30 seg;", n, server_utility_2b,  "*4;2 serv/media 1 min;");
title('Utilidad del servidor vs arribo de clientes');
xlabel('Clientes arribados');
ylabel('Nivel de utilidad');
print('utility.eps', '-deps');

clf;
plot(n, time_in_system, "+;media 1 min;", n, time_in_system_2a, "o3;media 30 seg;", n, time_in_system_2b, "*4;2 serv/media 1 min;");
title('Tiempo promedio por cliente vs arribo de clientes');
xlabel('Clientes arribados');
ylabel('Tiempo por cliente [min]');
print('mean_time.eps', '-deps');

clf;
plot(n, max_amount_queue, "+;media 1 min;", n, max_amount_queue_2a, "o3;media 30 seg;", n, max_amount_queue_2b, "*4;2 serv/media 1 min;");
title('Maxima cantidad en cola vs arribo de clientes');
xlabel('Clientes arribados');
ylabel('Maxima cantidad de clientes');
print('max_c_queue.eps', '-deps');

clf;
plot(n, max_delay_queue, "+;media 1 min;", n, max_delay_queue_2a, "o3;media 30 seg;", n, max_delay_queue_2b, "*4;2 serv/media 1 min;");
title('Maxima demora en cola vs arribo de clientes');
xlabel('Clientes arribados');
ylabel('Maxima demora en cola');
print('max_delay_queue.eps', '-deps');

clf;
plot(n, max_delay_system, "+;media 1 min;", n, max_delay_system_2a, "o3;media 30 seg;", n, max_delay_system_2b, "*4;2 serv/media 1 min;");
title('Maxima demora en sistema vs arribo de clientes');
xlabel('Clientes arribados');
ylabel('Maxima demora en sistema');
print('max_delay_system.eps', '-deps');

clf;
plot(n, more_than_one_minute, "+;media 1 min;", n, more_than_one_minute_2a, "o3;media 30 seg;", n, more_than_one_minute_2b, "*4;2 serv/media 1 min;");
title('Proporcion demora en sistema > 1 min vs arribo de clientes');
xlabel('Clientes arribados');
ylabel('Proporcion demorados');
print('more_than_one_minute.eps', '-deps');

